In [4]:
%load_ext autoreload
%autoreload 2

import etherscan.tokens as tokens
import json


The autoreload extension is already loaded. To reload it, use:
  %reload_ext autoreload

Import API key from file


In [5]:
with open('../../api_key.json', mode='r') as key_file:
    key = json.loads(key_file.read())['key']

Initiate the Etherscan API

Current tokenname options are:

'TheDAO'
'DGD'
'MKR'

In [6]:
api = tokens.Tokens(tokenname='TheDAO', api_key=key)

Get token balance of address


In [8]:
address = '0x0a869d79a7052c7f1b55a8ebabbea3420f0d1e13'
api.get_token_balance(address=address)


Out[8]:
'906521201346716282652810'

Get total supply of tokens


In [9]:
api.get_total_supply()


Out[9]:
'11538165987024671407837618'

In [ ]: